Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Database XML Java API Reference 10g Release 2 (10.2) B14293-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.xml.parser.v2
Class XMLParser

`java.lang.Object
oracle.xml.parser.v2.XMLParser`

Direct Known Subclasses:
  DOMParser, SAXParser

public abstract class XMLParser
extends java.lang.Object

This class serves as a base class for the `DOMParser` and `SAXParser` classes. It contains methods to parse eXtensible Markup Language (XML) 1.0 documents according to the World Wide Web Consortium (W3C) recommendation. This class can not be instantiated (applications may use the DOM or SAX parser depending on their requirements).

Field Summary
`protected java.util.Hashtable` | `attributes`
`static java.lang.String` | `BASE_URL` Base URL used in parsing entities.
`static java.lang.String` | `DTD_OBJECT` DTD Object to be used for validation.
`static java.lang.String` | `EXPAND_ENTITYREF` Expands entities when set to true, else report just the reference
`static java.lang.String` | `PARSER`
`static java.lang.String` | `PARSER_CDATA`
`static java.lang.String` | `PARSER_DTD`
`static java.lang.String` | `SCHEMA_LANGUAGE`
`static java.lang.String` | `SCHEMA_OBJECT` Schema Object to be used for validation.
`static java.lang.String` | `SCHEMA_SOURCE`
`static java.lang.String` | `STANDALONE` Sets the standalone property of the input files.
`static java.lang.String` | `USE_DTD_ONLY_FOR_VALIDATION` If true, DTD Object is used only for validation and is not added to the parser document (Boolean.TRUE or Boolean.FALSE) This property/attribute is only if setDoctype is called to use a fixed DTD.

Method Summary
`java.lang.Object` | `getAttribute(java.lang.String name)` Allows the user to retrieve specific attributes on the underlying implementation.
`java.net.URL` | `getBaseURL()` Gets the base URL
`EntityResolver` | `getEntityResolver()` Return the current entity resolver.
`ErrorHandler` | `getErrorHandler()` Return the current error handler.
`static java.lang.String` | `getReleaseVersion()` Returns the release version of the Oracle XML Parser
`boolean` | `getValidationMode()` Returns the validation mode
`int` | `getValidationModeValue()` Returns the validation mode
`java.lang.Object` | `getXMLProperty(java.lang.String name)` Get a property.
`boolean` | `isXMLPropertyReadOnly(java.lang.String name)` Check is the property is read-only Returns true if the property is not supported
`boolean` | `isXMLPropertySupported(java.lang.String name)` Check is the property is supported
`void` | `parse(InputSource in)` Parses the XML from given input source
`void` | `parse(java.io.InputStream in)` Parses the XML from given input stream.
`void` | `parse(java.io.Reader r)` Parses the XML from given input stream.
`void` | `parse(java.lang.String in)` Parses the XML from the URL indicated
`void` | `parse(java.net.URL url)` Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.
`void` | `reset()` Resets the parser state
`void` | `setAttribute(java.lang.String name, java.lang.Object value)` Allows the user to set specific attributes on the underlying implementation.
`void` | `setBaseURL(java.net.URL url)` Set the base URL for loading external enitites and DTDs.
`void` | `setDoctype(DTD dtd)` Set the DTD
`void` | `setEntityResolver(EntityResolver resolver)` Allow an application to register an entity resolver.
`void` | `setErrorHandler(ErrorHandler handler)` Allow an application to register an error event handler.
`void` | `setLocale(java.util.Locale locale)` Applications can use this to set the locale for error reporting.
`void` | `setPreserveWhitespace(boolean flag)` Set the white space preserving mode
`void` | `setSchemaValidationMode(boolean flag)` Deprecated. Replaced by setValidationMode(int).
`java.lang.Object` | `setSchemaValidatorProperty(java.lang.String name, java.lang.Object value)` Set an XML property to schema validator.
`void` | `setValidationMode(boolean yes)` Deprecated. Replaced by setValidationMode(int).
`void` | `setValidationMode(int valMode)` Set the validation mode This method sets the validation mode of the parser.
`java.lang.Object` | `setXMLProperty(java.lang.String name, java.lang.Object value)` Set a property.
`void` | `setXMLSchema(java.lang.Object schema)` Set an XMLSchema for validating the instance document

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DTD_OBJECT

    public static final java.lang.String DTD_OBJECT

  DTD Object to be used for validation. Replaces XMLParser.setDoctype()
  See Also:
    Constant Field Values

### PARSER_DTD

    public static final java.lang.String PARSER_DTD

  See Also:
    Constant Field Values

### PARSER_CDATA

    public static final java.lang.String PARSER_CDATA

  See Also:
    Constant Field Values

### PARSER

    public static final java.lang.String PARSER

  See Also:
    Constant Field Values

### USE_DTD_ONLY_FOR_VALIDATION

    public static final java.lang.String USE_DTD_ONLY_FOR_VALIDATION

  If true, DTD Object is used only for validation and is not added to the parser document (Boolean.TRUE or Boolean.FALSE) This property/attribute is only if setDoctype is called to use a fixed DTD.
  See Also:
    Constant Field Values

### SCHEMA_OBJECT

    public static final java.lang.String SCHEMA_OBJECT

  Schema Object to be used for validation. Replaces XMLParser.setXMLSchema()
  See Also:
    Constant Field Values

### SCHEMA_LANGUAGE

    public static final java.lang.String SCHEMA_LANGUAGE

  See Also:
    Constant Field Values

### SCHEMA_SOURCE

    public static final java.lang.String SCHEMA_SOURCE

  See Also:
    Constant Field Values

### BASE_URL

    public static final java.lang.String BASE_URL

  Base URL used in parsing entities. Replaces setBaseURL(); Should be URL object
  See Also:
    Constant Field Values

### STANDALONE

    public static final java.lang.String STANDALONE

  Sets the standalone property of the input files. If true the DTDs are not retrieved.
  See Also:
    Constant Field Values

### EXPAND_ENTITYREF

    public static final java.lang.String EXPAND_ENTITYREF

  Expands entities when set to true, else report just the reference
  See Also:
    Constant Field Values

### attributes

    protected java.util.Hashtable attributes

Method Detail

### reset

    public void reset()

  Resets the parser state

### parse

    public void parse(InputSource in)
               throws XMLParseException,
                      SAXException,
                      java.io.IOException

  Parses the XML from given input source
  Parameters:
    `in` - the `org.xml.sax.InputSouce` to parse
  Throws:
    `XMLParseException` - if syntax or other error encountered.
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `java.io.IOException` - IO Error.

### parse

    public void parse(java.lang.String in)
               throws XMLParseException,
                      SAXException,
                      java.io.IOException

  Parses the XML from the URL indicated
  Parameters:
    `in` - the `String` containing the URL to parse from
  Throws:
    `XMLParseException` - if syntax or other error encountered.
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `java.io.IOException` - IO Error.

### parse

    public final void parse(java.net.URL url)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

  Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.
  Parameters:
    `url` - the url points to the XML document to parse.
  Throws:
    `XMLParseException` - if syntax or other error encountered.
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `java.io.IOException` - IO Error.

### parse

    public final void parse(java.io.InputStream in)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

  Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.
  Parameters:
    `in` - the `InputStream` containing XML data to parse.
  Throws:
    `XMLParseException` - if syntax or other error encountered.
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `java.io.IOException` - IO Error.
  See Also:
    `setBaseURL(java.net.URL)`

### parse

    public final void parse(java.io.Reader r)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

  Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.
  Parameters:
    `r` - the `Reader` containing XML data to parse.
  Throws:
    `XMLParseException` - if syntax or other error encountered.
    `SAXException` - Any SAX exception, possibly wrapping another exception.
    `java.io.IOException` - IO Error.
  See Also:
    `setBaseURL(java.net.URL)`

### setEntityResolver

    public void setEntityResolver(EntityResolver resolver)

  Allow an application to register an entity resolver.

  If the application does not register an entity resolver, the XMLReader will perform its own default resolution.

  Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.

  Parameters:
    `resolver` - The entity resolver.
  Throws:
    `java.lang.NullPointerException` - If the resolver argument is null.
  See Also:
    `getEntityResolver()`

### getEntityResolver

    public EntityResolver getEntityResolver()

  Return the current entity resolver.
  Returns:
    The current entity resolver, or null if none has been registered.
  Since:
    SAX 2.0
  See Also:
    `setEntityResolver(org.xml.sax.EntityResolver)`

### setErrorHandler

    public void setErrorHandler(ErrorHandler handler)

  Allow an application to register an error event handler.

  If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

  Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

  Parameters:
    `handler` - The error handler.
  Throws:
    `java.lang.NullPointerException` - If the handler argument is null.
  See Also:
    `getErrorHandler()`

### getErrorHandler

    public ErrorHandler getErrorHandler()

  Return the current error handler.
  Returns:
    The current error handler, or null if none has been registered.
  Since:
    SAX 2.0
  See Also:
    `setErrorHandler(org.xml.sax.ErrorHandler)`

### setLocale

    public void setLocale(java.util.Locale locale)
                   throws SAXException

  Applications can use this to set the locale for error reporting.
  Parameters:
    `locale` - `Locale` to set
  Throws:
    `SAXException` - A `SAXException` could be thrown.
  See Also:
    `Parser.setLocale(java.util.Locale)`

### setDoctype

    public void setDoctype(DTD dtd)

  Set the DTD
  Parameters:
    `dtd` - `DTD` to set and used while parsing

### setSchemaValidationMode

    public void setSchemaValidationMode(boolean flag)

  Deprecated. Replaced by setValidationMode(int).
  Set the schema validation mode
  Parameters:
    `flag` - determines whether the XML parser should invoke schema validating

### setValidationMode

    public void setValidationMode(boolean yes)

  Deprecated. Replaced by setValidationMode(int).
  Set the validation mode
  Parameters:
    `yes` - determines whether the XML parser should be validating

### setValidationMode

    public void setValidationMode(int valMode)

  Set the validation mode This method sets the validation mode of the parser. Legal values are: NONVALIDATING, PARTIAL_VALIDATION, DTD_VALIDATION, SCHEMA_VALIDATION, SCHEMA_LAX_VALIDATION, and SCHEMA_STRICT_VALIDATION.
  Parameters:
    `valMode` - determines the type of the validation mode which the parser is set to

### setSchemaValidatorProperty

    public java.lang.Object setSchemaValidatorProperty(java.lang.String name,
                                                       java.lang.Object value)

  Set an XML property to schema validator. The value of the property set is returned if successfully set, a null is returned if schema validation is not initiallized or the property cannot be set or not supported.
  Parameters:
    `name` - - name of the property
    `value` - - value of the property
  Returns:
    Object - the set property

### setBaseURL

    public void setBaseURL(java.net.URL url)

  Set the base URL for loading external enitites and DTDs. This method should to be called if the parse(InputStream) is used to parse the XML Document
  Parameters:
    `url` - The base URL

### getBaseURL

    public java.net.URL getBaseURL()

  Gets the base URL
  Returns:
    the base URL

### setPreserveWhitespace

    public void setPreserveWhitespace(boolean flag)

  Set the white space preserving mode
  Parameters:
    `flag` - preserving mode

### getValidationMode

    public boolean getValidationMode()

  Returns the validation mode
  Returns:
    `true` if the XML parser is validating `false` if not

### getValidationModeValue

    public int getValidationModeValue()

  Returns the validation mode
  Returns:
    `0` if the XML parser is NONVALIDATING `1` if the XML parser is PARTIAL_VALIDATION `2` if the XML parser is DTD_VALIDATION `3` if the XML parser is SCHEMA_VALIDATION

### getReleaseVersion

    public static java.lang.String getReleaseVersion()

  Returns the release version of the Oracle XML Parser
  Returns:
    the release version string

### setXMLSchema

    public void setXMLSchema(java.lang.Object schema)

  Set an XMLSchema for validating the instance document
  Parameters:
    `schema` - The XMLSchema object

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object value)
                      throws java.lang.IllegalArgumentException

  Allows the user to set specific attributes on the underlying implementation.
  Parameters:
    `name` - The name of the attribute.
    `value` - The value of the attribute.
  Throws:
    `java.lang.IllegalArgumentException` - thrown if the underlying implementation doesn't recognize the attribute.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)
                                  throws java.lang.IllegalArgumentException

  Allows the user to retrieve specific attributes on the underlying implementation.
  Parameters:
    `name` - The name of the attribute.
  Returns:
    value The value of the attribute.
  Throws:
    `java.lang.IllegalArgumentException` - thrown if the underlying implementation doesn't recognize the attribute.

### setXMLProperty

    public java.lang.Object setXMLProperty(java.lang.String name,
                                           java.lang.Object value)

  Set a property. The value of the property set is returned if successfully set, a null is returned if the property is read-only and cannot be set or is not supported.
  Parameters:
    `name` - - name of the property
    `value` - - value of the property
  Returns:
    Object - the set property

### getXMLProperty

    public java.lang.Object getXMLProperty(java.lang.String name)

  Get a property. The property is returned if present and supported, else null is returned
  Parameters:
    `name` - - name of the property
  Returns:
    Object - value of the property

### isXMLPropertySupported

    public boolean isXMLPropertySupported(java.lang.String name)

  Check is the property is supported
  Parameters:
    `name` - - name of the property
  Returns:
    boolean - TRUE is supported

### isXMLPropertyReadOnly

    public boolean isXMLPropertyReadOnly(java.lang.String name)

  Check is the property is read-only Returns true if the property is not supported
  Parameters:
    `name` - - name of the property
  Returns:
    boolean - TRUE is read-only

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Database XML Java API Reference 10g Release 2 (10.2) B14293-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003, 2005, Oracle. All rights reserved.